
import axios from 'axios';

/**
 * 购物车
 */
export class ShoppingCartService {
    // 分页查询列表
    static findShoppingCarts (queryParams) {
        return axios({
            url: '/mall/good/ShoppingCart/findShoppingCarts',
            method: 'POST',
            data: queryParams
        });
    }

    //根据ID查询指定的购物车
    static findShoppingCart (shoppingCartId) {
        const query = {
            shoppingCartId
        }
        return axios({
            url: '/mall/good/ShoppingCart/findShoppingCart',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的购物车(包含外键名称)
    static findShoppingCartForView (shoppingCartId) {
        const query = {
            shoppingCartId
        }
        return axios({
            url: '/mall/good/ShoppingCart/findShoppingCartForView',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的购物车(包含外键名称)
    static findShoppingCartForEdit (shoppingCartId) {
        const query = {
            shoppingCartId
        }
        return axios({
            url: '/mall/good/ShoppingCart/findShoppingCartForEdit',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的购物车(只提取ID 和 Name)
    static findShoppingCartsWithIdNameById (shoppingCartId) {
        const query = {
            shoppingCartId
        }
        return axios({
            url: '/mall/good/ShoppingCart/findShoppingCartsWithIdNameById',
            method: 'POST',
            params: query,
        });
    }

    //根据名称查询购物车集合(只提取ID 和 Name)
    static findShoppingCartsWithIdNameByName (shoppingCartName) {
        const query = {
            shoppingCartName
        }
        return axios({
            url: '/mall/good/ShoppingCart/findShoppingCartsWithIdNameByName',
            method: 'POST',
            params: query,
        });
    }

    //新增保存购物车
    static saveShoppingCart (shoppingCart) {
        const query = {}
        return axios({
            url: '/mall/good/ShoppingCart/saveShoppingCart',
            method: 'POST',
            params: query,
            data: shoppingCart
        });
    }

    //修改保存购物车
    static updateShoppingCart (shoppingCart) {
        const query = {}
        return axios({
            url: '/mall/good/ShoppingCart/updateShoppingCart',
            method: 'POST',
            params: query,
            data: shoppingCart
        });
    }

    //根据ID查询指定的购物车(只提取ID 和 Name)
    static deleteShoppingCart (shoppingCartId) {
        const query = {
            shoppingCartId
        }
        return axios({
            url: '/mall/good/ShoppingCart/deleteShoppingCart',
            method: 'POST',
            params: query,
        });
    }
}
